using System;

public class ARPGTestPlayerStateBehaviour
{
    public Action<ARPGTestPlayerStateBehaviour> onMoveEnter, onMoveExit, onMoveUpdate, onDeathEnter, onDeathExit, onDeathUpdate, onIdolEnter, onIdolExit, onIdolUpdate, onAttackEnter, onAttackExit, onAttackUpdate;
    ARPGTestPlayerState state;
    public ARPGTestPlayerState State => state;
    public void StateUpdate()
    {
         switch (state)
         {
          case ARPGTestPlayerState.Move:
               MoveStateUpdate();
               break;
          case ARPGTestPlayerState.Death:
               DeathStateUpdate();
               break;
          case ARPGTestPlayerState.Idol:
               IdolStateUpdate();
               break;
          case ARPGTestPlayerState.Attack:
               AttackStateUpdate();
               break;
         }
    }
    public void StateExit()
    {
         switch (state)
         {
          case ARPGTestPlayerState.Move:
               MoveStateExit();
               break;
          case ARPGTestPlayerState.Death:
               DeathStateExit();
               break;
          case ARPGTestPlayerState.Idol:
               IdolStateExit();
               break;
          case ARPGTestPlayerState.Attack:
               AttackStateExit();
               break;
         }
    }
    public void EnterMoveState()
    {
        StateExit();
        state = ARPGTestPlayerState.Move;
        onMoveEnter?.Invoke(this);
    }

    void MoveStateExit()
    {
        onMoveExit?.Invoke(this);
    }

    void MoveStateUpdate()
    {
        onMoveUpdate?.Invoke(this);
    }

    public void EnterDeathState()
    {
        StateExit();
        state = ARPGTestPlayerState.Death;
        onDeathEnter?.Invoke(this);
    }

    void DeathStateExit()
    {
        onDeathExit?.Invoke(this);
    }

    void DeathStateUpdate()
    {
        onDeathUpdate?.Invoke(this);
    }

    public void EnterIdolState()
    {
        StateExit();
        state = ARPGTestPlayerState.Idol;
        onIdolEnter?.Invoke(this);
    }

    void IdolStateExit()
    {
        onIdolExit?.Invoke(this);
    }

    void IdolStateUpdate()
    {
        onIdolUpdate?.Invoke(this);
    }

    public void EnterAttackState()
    {
        StateExit();
        state = ARPGTestPlayerState.Attack;
        onAttackEnter?.Invoke(this);
    }

    void AttackStateExit()
    {
        onAttackExit?.Invoke(this);
    }

    void AttackStateUpdate()
    {
        onAttackUpdate?.Invoke(this);
    }

}
